<!--
 * @Description: 
 * @Autor: codeBo
 * @Date: 2023-03-09 18:35:15
 * @LastEditors: gjzxlihaibo@163.com
 * @LastEditTime: 2023-03-10 11:28:52
-->
<template>
  <svg :class="svgClass" aria-hidden="true">
    <use :xlink:href="iconName"></use>
  </svg>
</template>

<script lang="ts">
import { computed } from "vue";
export default {
  name: "BaseSvgIcon",
  props: {
    iconClass: { type: String, default: () => "" },
    className: { type: String, default: () => "" },
  },
  setup(props) {
    const iconName = computed(() => {
      return props.iconClass ? `#icon-${props.iconClass}` : "#icon";
    });
    const svgClass = computed(() => {
      return props.className ? "svg-icon " + props.className : "svg-icon";
    });
    return { iconName, svgClass };
  },
};
</script>

<style scoped lang="less">
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
